home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / fido / RFS275.lha / rexx / WfreqList.rexx < prev   
OS/2 REXX Batch file  |  1993-11-25  |  10KB  |  271 lines

  1. /**/
  2. v="$VER: WFreqList  Rexx WPL Freq List Creator Williamson 53.04"
  3. /*
  4.    Based on Falcon File Manager by Robert Williamson 1:167/104.0
  5.         Originally Modified for Falcon CBCS By Tony Jones (2:255/35)
  6.         from Tim Aston's TransAmiga BBS script, FileUtil.trans
  7.  
  8.       Be sure to change the List command exclusion parameters (EXCLUDE)  
  9.       for those files you want ignored in listings
  10.  
  11.     Config File Format: (bbslist)
  12.     AREA 1
  13.     NAME "Communications SOFTWARE"
  14.     PATH "BBSFILES:comms/"
  15.     LEVEL NORMAL
  16.     PASSWORD areapassword               <---optional password for area
  17. */
  18. debug=0
  19. sort=0
  20. /* LIST exclusion parameters    */
  21. EXCLUDE     =   '~(empty|area.text|files.bbs|LZTEMP.#?|.info)'
  22. /* WB2 List Lformat parameters  */
  23. LFFREQ      =   '"%N %F%N"'                       /* freq.lst         */
  24.  
  25. /*  You must create these files */
  26. bbslist     = "RAM:config/fileareas.bbs"               /* filearea config  */
  27. mtext       = "CFG:MAGIC.TXT"                   /* FREQ Magic names */
  28.  
  29. /* System description header */
  30. /* This should also contain the list of MAGIC filenames accepted */
  31. htext       = "CFG:filelistheader.txt" 
  32.  
  33. fldir       = "Mail:FILELISTS"                 /* Freqable filelists dir */
  34. /* Note: some Freq makers require that this standard be followed */
  35. all_list     = "01670104.LST"                   /* Normal Level List */
  36. all_arc      = "01670104.LHA"                   /* Archived Normal List */
  37. new_list     = "NEWFILES.LST"                   /* Newfiles list */
  38.  
  39.  
  40. /* output files - edit names to suit */
  41. freqlist     = "MAIL:freq.lst"                  /* filename, full path */
  42.  
  43.  
  44. /* Configuration of Magic File Names for FREQ List              */
  45. /* Standard MAGIC FileNames That Never Change                   */
  46. /* DO NOT change these entries, these are configured above      */
  47. magic.1 = "FILES    > "addslash(fldir)||all_arc     /* configured above */
  48. magic.2 = "NEWFILES > "addslash(fldir)||new_list    /* configured above */
  49. magic.3 = "NEW      > "addslash(fldir)||new_list    /* configured above */
  50. magic.4 = "MAGIC    > "htext                         /* configured above */
  51. magic.5 = "ABOUT    > "htext                         /* configured above */
  52.  
  53. /* add your FIXED MAGIC names here */
  54. magic.6     = "ROOFREXX > bbsf6:ROOF/ROOF_REXX.LHA"
  55. magic.7     = "ROOFDOS  > bbsf6:ROOF/ROOF_DOS.LHA"
  56. magic.8     = "ROOFDOCS > bbsf6:ROOF/ROOF_DOCS.LHA"
  57. magic.9     = "ROOFBIN  > bbsf6:ROOF/ROOF_BIN.LHA"
  58. magic.10    = "ROOFRCP  > bbsf6:ROOF/ROOF_RCP.LHA"
  59. magic.11    = "ROOFWPL  > BBSF6:ROOF/ROOF_WPL.LHA"
  60. magic.12    = "ROOF     > BBSF6:ROOF/ROOF.LHA"
  61.  
  62. /* FileNames that require updating to the latest version should */
  63. /* use '^' instead of '>'                                       */
  64. magic.13    = "FILEMGR      ^ BBSF6:ROOF/FILEMGR_V??.??.LHA"
  65. magic.14    = "FANSI        ^ BBSF4:G&S/FANSI_V?.?.LHA"
  66. magic.15    = "DEKSID       ^ BBSF6:DUTIL/DEK???.LHA"
  67. magic.16    = "BBSLIST      ^ BBSF5:MTL-BBS/BBS?????.LST"
  68.  
  69. /* Where more than one file will be sent for a MAGIC name       */
  70. /* just have multiple entries pointing to same magic name       */
  71. magic.17 = "WELMAT          > BBSF6:WPL/WPL_DOC.LHA"
  72.  
  73. magic.18 = "MAILSCAN        > BBSF6:FALCON/MailScan_v1.39.LHA"
  74. magic.19 = "ROOFBBS         > bbsf6:ROOF/Roof_BBS.LHA"
  75. magic.20 = "ROOFRCP         > BBSF6:ROOF/ROOF_RCP.LHA"
  76. magic.21 = "ROOFTA          > BBSF6:ROOF/ROOF_TA.LHA"
  77. magic.22 = "ROOFDLG         > BBSF6:ROOF/ROOF_DLG.LHA"
  78.  
  79. magic.23 = "AREAMGR         ^ BBSF6:ROOF/AM_v????.LHA"
  80. magic.24 = "CFG             > CFG:WPL/ROOF.WPL"
  81. magic.25 = "CFG             > CFG:WPL/ROOFCFG.WPL"
  82. magic.26 = "CFG             > CFG:WPL/ROOFMENUS.WPL"
  83. magic.27 = "CFG             > CFG:WPL/ROOFNOTIFY.WPL"
  84. magic.28 = "CFG             > CFG:ROOF.CFG"
  85. magic.29 = "BTC             > S:BTC"
  86. magic.30 = "RFS              > BBSF6:ROOF/RFS.LHA"
  87. magic.31 = "WPL             > BBSF6:WPL/WPL_DOC.LHA"
  88. magic.32 = "UMBRELLA        > BBSF6:wpl/UMBRELLA.LHA"
  89. magic.33 = "GENMAILER       > BBSF6:wpl/GENMAILER.LHA"
  90. magic.34 = "GAZEBO          > BBSF6:wpl/GAZEBO.LHA"
  91. magic.35 = "PORTICUS        > BBSF6:wpl/PORTICUS.LHA"
  92. magics = 35
  93. magic.0 = 35
  94. /* NUMBER of MAGIC NAMES */
  95.  
  96. /* used internally */
  97. freqtemp = "T:FLST-"Pragma('ID')            /* temporary freq list */
  98.  
  99. script  = "WFreqList"
  100. ver     = "v"||right(v,5)
  101. lf      = '0a'x
  102. CSI     = '9b'x
  103. OFF     = CSI||'0m'
  104. BOLD    = CSI||'1m'
  105. ULINE   = CSI||'4m'
  106. ITALICS = CSI||'3;40m'
  107. quote   = '"'
  108.  
  109. fmvers  = BOLD||''script ver||OFF
  110. options results
  111. options failat 20
  112. signal on halt
  113. signal on ioerr
  114. signal on break_c
  115. signal on break_d
  116.  
  117.     call close('STDOUT')
  118.     call open('STDOUT',"RAW:0/10/640/100/"script ver"/CLOSE",'w')
  119.     call close('STDIN')
  120.     call open('STDIN','*','R')
  121.  
  122. if ~show("L", "rexxsupport.library") then
  123.     if ~addlib("rexxsupport.library", 0, -30, 0) then
  124.         do
  125.                 call writeln(STDOUT, "Couldn't access support.library !")
  126.                 exit 20
  127.         end
  128.  
  129.  
  130.     if ~open('dlst',bbslist, 'R') then
  131.     do
  132.         call writeln(STDOUT, "Couldn't open fileareas list !")
  133.         exit 20
  134.     end
  135.     if show('p',"ROOFLOG") then address 'ROOFLOG' 'logline' left(time(),5) script': Updating Freq Listing'
  136.     call writeln(STDOUT, lf||ITALICS||" "fmvers||lf||" by Robert Williamson 1:167/104.0@fidonet"||OFF)
  137.     /* Start Area Processing */
  138.     call writeln(STDOUT, 'Reading file area configuration')
  139.     area = 0
  140.     do while ~eof('dlst')
  141.         call writech(STDOUT,'.')
  142.         blstln=readln('dlst')
  143.         if blstln="" then iterate
  144.         blstkey=upper(left(blstln, 4))
  145.         select
  146.             when blstkey = 'AREA' then
  147.             do
  148.                 area=area+1
  149.                 Number.area=strip(word(blstln,2) )
  150.             end
  151.             when blstkey= 'NAME' then Name.area=strip( substr(blstln,6,79) )
  152.             when blstkey= 'PATH' then Path.area=strip( dequote(substr(blstln,6,40) ))
  153.             when blstkey= 'PASS' then Password.area=strip(word(blstln,2) )
  154.             when blstkey= 'LEVE' then
  155.             do
  156.                 lvl=word(blstln,2)
  157.                 if lvl = 'TWIT' | lvl="DISGRACE" | lvl="NORMAL" then Level.area='INCLUDE'
  158.                     else Level.area='EXCLUDE'   
  159.             end
  160.             otherwise NOP
  161.         end  /* select */
  162.  
  163.         if Level.area="EXCLUDE" then 
  164.         do
  165.             call writeln(STDOUT,lf||'Area' Number.area Name.area 'excluded')
  166.             if area >1 then 
  167.             do
  168.                 Level.area=""
  169.                 area=area-1
  170.                 Iterate
  171.             end
  172.         end
  173.     end /*eof*/
  174.  
  175.     areas=area-1
  176.     call writeln(STDOUT,lf||'Found 'areas' file areas')
  177.  
  178.     call writeln(STDOUT, BOLD||"Generating File Request Listing"||OFF||lf)
  179.     if exists(mtext) then address COMMAND 'Copy' mtext freqtemp
  180.     else do
  181.         call open('lstf',freqtemp,'W')      /* create the file */
  182.         call close('lstf')                 /* delete old one  */
  183.     end
  184.     if (magics ~= 0) then
  185.     do
  186.         CR='0a'x
  187.         if ~open('tfl',freqtemp,'A') then
  188.         do
  189.             call writeln(STDOUT, 'Unable to open 'freqtemp)
  190.             exit 10
  191.         end
  192.         call writeln(STDOUT, 'Updating 'magics' Magic names')
  193.         do i=1 to magics
  194.             call writech(STDOUT,'.')
  195.             /*                                                  file/magicname           !password                fullpath */
  196.             if left(word(magic.i,2),1) = '!' then writech('tfl',strip(word(magic.i,1))' 'strip(word(magic.i,2))' 'strip(word(magic.i,3))||CR)
  197.                 else if word(magic.i,2) = '>' then writech('tfl',strip(word(magic.i,1))' 'strip(word(magic.i,3))||CR)
  198.             if word(magic.i,2) = '^' then
  199.             do
  200.                 close('tfl')
  201.                 cmd='List >>'freqtemp word(magic.i,3) LFORMAT '"'word(magic.i,1)' %P%N"'
  202.                 address COMMAND cmd
  203.                 open('tfl',freqtemp,'A')
  204.             end
  205.         end
  206.         call close('tfl')
  207.     end
  208.  
  209.     call writeln(STDOUT, lf||'Processing')
  210.     do area=1 to areas
  211. /*        if ~debug then call writech(STDOUT,'.')   */
  212.         if ~debug then call writeln(STDOUT,Path.area)
  213.         else do
  214.             /* Display info on a area */
  215.             call writeln(STDOUT, BOLD||'Area       '||OFF Number.area)
  216.             call writeln(STDOUT, BOLD||'Name       '||OFF Name.area)
  217.             call writeln(STDOUT, BOLD||'Path       '||OFF Path.area)
  218.         end
  219.         if Password.area = "PASSWORD."area | Password.area = "" then 
  220.         do
  221.             if debug then call writeln(STDOUT, BOLD||'Password   '||OFF 'none')
  222.             address COMMAND 'List >>"'freqtemp'"' Path.area||exclude 'FILES NOHEAD LFORMAT='LFFREQ
  223.         end
  224.         else do
  225.             if debug then call writeln(STDOUT, BOLD||'Password   '||OFF Password.area)
  226.             address COMMAND 'List >>"'freqtemp'"' Path.area||exclude 'FILES NOHEAD LFORMAT="%N !'Password.area' %F%N"'
  227.         end
  228.     end
  229.     
  230.     if sort then
  231.     do
  232.         call writeln(STDOUT, BOLD||'Sorting 'freqtemp' to 'freqlist||OFF)
  233.         address COMMAND 'SORT' freqtemp freqlist
  234.     end
  235.     else do
  236.         address COMMAND 'COPY' freqtemp freqlist
  237.         if RC=0 then call delete(freqtemp)      
  238.     end
  239.     if exists("RAM:FREQ.LST") then address COMMAND 'Copy' freqlist "RAM:FREQ.LST"
  240.     call writeln(STDOUT, 'Freq Listing completed')
  241.     if show('p',"ROOFLOG") then address 'ROOFLOG' 'logline' left(time(),5) script': Freq Listing completed'
  242. exit
  243.  
  244. /* a useful procedure by Walt Sullivan  */
  245. dequote:
  246.     parse arg thing
  247.     parse var thing '"' unq_thing '"'
  248.     if unq_thing ~= "" then return unq_thing
  249. return thing
  250.  
  251. addslash:
  252.     curr = arg(1)
  253.     select
  254.         when right(curr, 1) = ":" then nop
  255.             when right(curr, 1) = "/" then nop
  256.                 otherwise curr = curr"/"
  257.     end
  258. return curr
  259.    
  260. /*
  261.   Error handling
  262. */
  263.  
  264. halt:
  265. ioerr:
  266. break_c:
  267. break_d:
  268.     call writech(STDOUT,lf)
  269.     exit 10
  270.  
  271.